<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<% 
	String Rootpath = request.getContextPath();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<script type="text/javascript">
		function onClickLogin(){
			var f1 = document.form1;
			var loginName1 = "admin";
			var loginPass1 = "admin";
			var loginName2 = "personal";
			var loginPass2 = "personal";
			var userName = document.getElementById("txtUsername").value;
			var passWord = document.getElementById("txtPassword").value;
			//alert(userName);
			//alert(passWord);	
			
			if(userName == "" || userName == null || passWord == "" || passWord == null){
				alert("Login failed");
				document.getElementById("txtUsername").value = "";
				document.getElementById("txtPassword").value = "";
			}else if(userName == loginName1 && passWord == loginPass1){
				//alert("Login Successful");
				f1.action="<%=(Rootpath)%>/jsp/MainMenu_Admin.jsp";
				f1.submit();
				document.getElementById("txtUsername").value = "";
				document.getElementById("txtPassword").value = "";
			}else if(userName == loginName2 && passWord == loginPass2){
				//alert("Login Successful");
				f1.action="<%=(Rootpath)%>/jsp/MainMenu_Personal.jsp";
				f1.submit();
				document.getElementById("txtUsername").value = "";
				document.getElementById("txtPassword").value = "";
			}
		}
	</script>
<link type="text/css" rel="StyleSheet" href="<%=(Rootpath)%>/css/Style.css" />
<title>User Login</title>
</head>
<body bgcolor="#88BCFF">
<form name="form1" id="form1" method="post">
	<table width="750" height="517" border="0" cellspacing="0" cellpadding="0"  align="center" background="<%=Rootpath%>/images/login1.jpg">
		<tr height="320">
			<td colspan="2">
				&nbsp;
			</td>
		</tr>
		<tr height="40">
			<td width="45%" align="right">
				<span>Username :</span>&nbsp;
			</td>
			<td>
				<input type="text" name="txtUsername" id="txtUsername" value="" size="20">
			</td>
		</tr>	
		<tr height="40">
			<td width="45%" align="right">
				<span>Password :</span>&nbsp;
			</td>
			<td>
				<input type="password" name="txtPassword" id="txtPassword" value="" size="21">
			</td>
		</tr>
		<tr height="40">
			<td width="45%" align="center">
				
			</td>
			<td>
				<input class="loginButton" type="button" name="btnLogin" id="btnLogin" value="Login" onclick="onClickLogin();">
			</td>
		</tr>
		<tr>
			<td width="45%" align="right">
				&nbsp;
			</td>
			<td>
				
			</td>
		</tr>				
	</table>
	<input type="hidden" name="username" id="username" value="">
	<input type="hidden" name="password" id="password" value="">
	<input type="hidden" name="mode" id="mode" value="">
	<input type="hidden" name="jsp" id="jsp" value="">
</form>
</body>
</html>